import {是浏览器环境否} from 'amtf/utils';

export const props = {
  // 如果是select组件将特殊处理
  isSelect: { type: Boolean, default: false },
  showOperation: { type: Boolean, default: false },
  width: { type: Number, default: 90 },
  // select的最大宽度(超出隐藏)
  maxWidth: { type: Number, default: 0 },
  // max height
  maxHeight: { type: Number, default: 1000 },
  // 如果为true会包含checkbox
  isMultiple: { type: Boolean, default: false },
  // 用户传入v-model的值[{value/label/selected}]
  modelValue: { type: Array, default: null },
  // 文本居中方式left|center|right
  textAlign: { type: String, default: 'left' },
  // 是否支持输入input
  isInput: { type: Boolean, default: false },
  // confirm filter text
  confirmFilterText: { type: String, default: '' },
  // confirm filter text
  resetFilterText: { type: String, default: '' },
  // hide by single selection item click
  hideByItemClick: { type: Boolean, default: false },
  // is show radio when single selection
  showRadio: { type: Boolean, default: false },
  // 当isControlled = true, visible生效
  visible: { type: Boolean, default: false },
  // is controlled
  isControlled: { type: Boolean, default: false },
  // is custom content
  isCustomContent: { type: Boolean, default: false },
  // instance between dropdown items and trigger element
  defaultInstance: { type: Number, default: 5 },
  // popper append to element
  popperAppendTo: {
    type: [String, 是浏览器环境否 ? HTMLElement : Object],
    default: () => document.body,
  },
  /*
      before visible change
      如果返回false则阻止显示或者关闭
      */
  beforeVisibleChange: { type: Function, default: null },
}

// emit events
export const EMIT_EVENTS = {
  FILTER_RESET: "filter-reset",
  FILTER_CONFIRM: "filter-confirm",
  VISIBLE_CHANGE: "dropdown-visible-change",
  ITEM_SELECT_CHANGE: "item-select-change",
};
